home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mikecom / txblksup.asm < prev    next >
Assembly Source File  |  1987-05-16  |  2KB  |  49 lines

  1.  
  2. title TRANSMIT BLK SUPPORT FUNCTION
  3. include subfx.h
  4.  
  5. ;  Mike Dumdei,  6 Holly Lane,  Texarkana TX  75503
  6.  
  7. ;---------------------------------------------------------------------------
  8. ; Procedure to move a block of data to the transmit buffer.
  9. ;
  10. ;  Entry: SI = pointer to com port data structure
  11. ;         ES:DI = ptr to start loc in tx_bufr where blk is to be placed
  12. ;         BX = offset of block to be moved,  CX = nbr chars to move
  13. ;
  14. ;  Exit : ES:DI and BX updated to point to next char to move in case there
  15. ;         is more to be moved
  16. ;---------------------------------------------------------------------------
  17. begseg          COMM_TEXT
  18. localproc       __txblk_fill
  19. public          __txblk_fill
  20.         push    si
  21.         mov     dx,TX_TOP       ; regs after init:
  22.         mov     si,TX_BTM       ;CX=bytes to move,  DX=TX_TOP,  BX=TX_BTM
  23.         xchg    bx,si           ;ES:DI=dest in txbufr,  DS:SI=ptr to block
  24. ifdef FARDATA
  25.         push    ds
  26.         mov     ds,TxImdSeg
  27. endif
  28.         cld
  29. txmov_lp:
  30.         movsb                   ;move a char from block to tx bufr
  31.         cmp     di,bx           ;ck if past end of tx buffer
  32.         je      txbuf_wrap      ; and set ptr to top of txbuf if necessary
  33.         loop    txmov_lp        ;repeat till CX chars moved
  34.         jmp s   exit_blkfill
  35. txbuf_wrap:
  36.         mov     di,dx
  37.         loop    txmov_lp
  38. exit_blkfill:
  39. ifdef FARDATA
  40.         pop     ds
  41. endif
  42.         mov     bx,si           ;BX=ptr to next char in block to move if more
  43.         pop     si              ;restore ptr to comm structure
  44.         ret
  45. __txblk_fill    endp
  46.  
  47. endseg          COMM_TEXT
  48.         end
  49.